<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 
	xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	lang="en">
	
	<ui:decorate template="/WEB-INF/facelets/faceletEditar.xhtml">
		<ui:define name="form">
			<h:form styleClass="form-horizontal"  enctype="multipart/form-data">
				
				<p:messages id="mensagens"></p:messages>	
				
				<fieldset>
					<legend>Cadastro de Livros</legend>
					
					<div class="control-group">		
						<h:outputLabel value="Nome:" for="nome" styleClass="control-label" />
						<p:inputText id="nome" value="#{LivroMB.entidade.nome}" maxlength="200"/>
					</div>
					
					<div class="control-group">	
						<h:outputLabel value="Autor:" for="autor" styleClass="control-label" />
						<p:inputText id="autor" value="#{LivroMB.entidade.autor}" maxlength="200"/>
					</div>
					
					<div class="control-group">
						<h:outputLabel value="Autor Espiritual:" for="autorEspiritual" styleClass="control-label" />
						<p:inputText id="autorEspiritual" value="#{LivroMB.entidade.autorEspiritual}" maxlength="200"/>
					</div>
					
					<div class="control-group">
						<h:outputLabel value="Mês:" for="mes" styleClass="control-label" />
						<p:selectOneMenu id="mes" value="#{LivroMB.entidade.mes}">
							<f:converter converterId="javax.faces.Integer"></f:converter>
							<f:selectItem itemValue="1" itemLabel="Janeiro"></f:selectItem>
							<f:selectItem itemValue="2" itemLabel="Fevereiro"></f:selectItem>
							<f:selectItem itemValue="3" itemLabel="Março"></f:selectItem>
							<f:selectItem itemValue="4" itemLabel="Abril"></f:selectItem>
							<f:selectItem itemValue="5" itemLabel="Maio"></f:selectItem>
							<f:selectItem itemValue="6" itemLabel="Junho"></f:selectItem>
							<f:selectItem itemValue="7" itemLabel="Julho"></f:selectItem>
							<f:selectItem itemValue="8" itemLabel="Agosto"></f:selectItem>
							<f:selectItem itemValue="9" itemLabel="Setembro"></f:selectItem>
							<f:selectItem itemValue="10" itemLabel="Outubro"></f:selectItem>
							<f:selectItem itemValue="11" itemLabel="Novembro"></f:selectItem>
							<f:selectItem itemValue="12" itemLabel="Dezembro"></f:selectItem>
						</p:selectOneMenu>
						
					</div>
					
					<div class="control-group">
						<h:outputLabel value="Ano:" for="ano" styleClass="control-label" />
						<p:inputMask id="ano" value="#{LivroMB.entidade.ano}" maxlength="4" mask="9999"/>
					</div>
					
					<div class="control-group">
						<p:commandButton 
							value="Gravar" 
							action="#{LivroMB.gravar}"
							update="mensagens"/>
							
						<p:commandButton 
							value="Excluir" 
							action="#{LivroMB.excluir}"
							rendered="#{LivroMB.exibirExcluir}"
							onclick="confirmation.show()" 
						    type="button"/>
								
						<p:confirmDialog 
							id="confirmDialog" 
							message="Confimar a exclusão do registro?"  
						    header="Confirmação!" 
						    severity="alert" 
						    widgetVar="confirmation">  
						                  
							<p:commandButton 
							   	id="confirm" 
							   	value="Sim" 
							   	oncomplete="confirmation.hide()"  
							    action="#{LivroMB.excluir}"/>  
							        
							<p:commandButton 
							  	id="decline" 
							   	value="Não" 
							   	onclick="confirmation.hide()" 
							   	type="button" />   
						                  
						</p:confirmDialog>
					</div>
				</fieldset>
			</h:form>
		</ui:define>
	</ui:decorate>
</html>